<?php
namespace app\api\service\pay;

use think\facade\Config;
use app\api\service\pay\lakala\LakalaAdapter;

class PlatformFactory
{
    public static function create(string $platformName): PlatformInterface
    {
        $config = Config::get('pay.platforms.' . $platformName, []);

        switch ($platformName) {
            case 'lakala_pro':
                return new LakalaAdapter($config);
            case 'lakala_dev':
                return new LakalaAdapter($config);
            default:
                throw new \InvalidArgumentException("不支持的平台: {$platformName}");
        }
    }
}